package com.wk.code.wkserver.controller.app;

import com.wk.code.wkserver.controller.common.BaseController;
import com.wk.code.wkserver.request.base.BasePageRequest;
import com.wk.code.wkserver.response.app.BalanceDetailResponse;
import com.wk.code.wkserver.response.app.EstimateDetailResponse;
import com.wk.code.wkserver.response.result.R;
import com.wk.code.wkserver.service.IUserWithdrawService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: wangqiang
 * @create: 2021-09-01 14:53
 */
@RestController
@RequestMapping("/wallet")
@AllArgsConstructor
@Api(tags = "app-前台我的钱包管理")
public class WalletController extends BaseController {

    final IUserWithdrawService userWithdrawService;

    /**
     * 余额记录
     *
     * @param request request
     * @return R
     */
    @ApiOperation(value = "余额记录")
    @PostMapping("balanceRecord")
    public R<BalanceDetailResponse> balanceRecordList(@RequestBody BasePageRequest request) {
        return R.success(userWithdrawService.balanceDetail(getUserId(), request));
    }


    /**
     * 预估金额
     *
     * @param request request
     * @return R
     */
    @ApiOperation(value = "预估金额列表")
    @PostMapping("estimateDetail")
    public R<EstimateDetailResponse> estimateDetail(@RequestBody BasePageRequest request) {
        return R.success(userWithdrawService.estimateDetail(getUserId(), request));
    }
}
